package com.interview.ujiuye2;

import java.util.HashSet;
import java.util.Set;

public class AAA {
    static class A {
        @Override
        public int hashCode() {
            return 123;
        }

        @Override
        public boolean equals(Object obj) {
            boolean b = super.equals(obj);
            System.out.println("equals:" + b);
            return b;
        }
    }

    public static void main(String[] args) {
        Set<A> set = new HashSet<>();
        A a = new A();
        A b = new A();
        set.add(a);
        set.add(b);
        System.out.println(set.size());

        String str1 = "OK";
        StringBuffer str2 = new StringBuffer(str1);
        String str3 = new String(str1);
        StringBuilder str4 = new StringBuilder(str1);
        System.out.println(str1.hashCode());
        System.out.println(str2.hashCode());
        System.out.println(str3.hashCode());
        System.out.println(str4.hashCode());

    }
}